﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;

/// <summary>
/// VisiterRecord 的摘要说明
/// </summary>
public class VisiterRecord
{
	public VisiterRecord()
	{
		//
		// TODO: 在此处添加构造函数逻辑
		//
        connection = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
        //connection = //GetConfigContent.ConnectionStringNews;
        //"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
        //    HttpContext.Current.Server.MapPath("~/App_Data/rss.mdb");
    }
    public void InsertVisitRecord(string ip)
    {
        if (ip.Length > 15)
        { ip = ip.Remove(14); }
        //DateTime d = DateTime.Now;
        //string visitTime = d.ToShortDateString() + " " + d.Hour.ToString() + ":" + d.Minute.ToString() + ":" + d.Second.ToString();
        //string command = "insert into VisitRecord(IPAddress,VisitTime) values('" + ip + "','" + visitTime + "')";
        string command = "insert into VisitRecord(IPAddress) values('" + ip + "')";
        OleDbConnection cnn = new OleDbConnection(connection);
        OleDbCommand cmd = new OleDbCommand(command, cnn);
        try
        {
            cnn.Open();
            cmd.ExecuteNonQuery();
        }
        catch (OleDbException oe)
        { }
        finally { cnn.Close(); }
    }
    private string connection;
}
